<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <div><img src="//www.baidu.com/img/baidu_jgylogo3.gif"></div>
  <script>
    if ('serviceWorker' in navigator) {
      window.addEventListener('load', function () {
        navigator.serviceWorker.register('./sw.js')
          .then(function (registration) {
            console.log('ServiceWorker registration successful with scope：', registration.scope)
          })
          .catch(function (error) {
            console.log('ServiceWorker registration failed:', err)
          })
      })
    }
  </script>
</body>
</html>